package com.test.sdk.core.controller;

import com.test.sdk.common.pojo.Game;
import com.test.sdk.common.util.ErrorConstants;
import com.test.sdk.common.util.ResponseTO;
import com.test.sdk.core.cache.GameCache;
import com.test.sdk.core.exception.SdkException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 徒有琴
 */
@RestController
public class GameController {

    @RequestMapping("/common/init.html")
    public ResponseTO init(Integer cpid, Integer seqnum, Integer prtchid) throws SdkException {
        Game game = GameCache.getGameByCpIdAndSeqNum(cpid, seqnum);
        ResponseTO res = new ResponseTO();
//        if (game == null) {
//            res.setError(ErrorConstants.GAME_NOT_EXIST);//后续会优化
//        } else {
        res.setSuccess(true);
        res.setResult(game);
        //}
        return res;
}
}
